<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic
  PUBLIC "-//OASIS//DTD DITA Composite//EN" "ditabase.dtd">
<topic id="topic1"><title id="dd20941">DROP ROLE</title><body><p id="sql_command_desc">Removes a database role.</p><section id="section2"><title>Synopsis</title><codeblock id="sql_command_synopsis">DROP ROLE [IF EXISTS] <varname>name</varname> [, ...]</codeblock></section><section id="section3"><title>Description</title><p><codeph>DROP ROLE</codeph> removes the specified role(s). To drop a
superuser role, you must be a superuser yourself. To drop non-superuser
roles, you must have <codeph>CREATEROLE</codeph> privilege.</p><p>A role cannot be removed if it is still referenced in any database; an error will be raised if
        so. Before dropping the role, you must drop all the objects it owns (or reassign their
        ownership) and revoke any privileges the role has been granted on other objects. The
            <codeph><xref href="REASSIGN_OWNED.xml#topic1">REASSIGN OWNED</xref></codeph> and
            <codeph><xref href="DROP_OWNED.xml#topic1">DROP OWNED</xref></codeph> commands can be
        useful for this purpose. </p><p>However, it is not necessary to remove role memberships involving
the role; <codeph>DROP ROLE</codeph> automatically revokes any memberships
of the target role in other roles, and of other roles in the target role.
The other roles are not dropped nor otherwise affected.</p></section><section id="section4"><title>Parameters</title><parml><plentry><pt>IF EXISTS</pt><pd>Do not throw an error if the role does not exist. A notice is issued
in this case.</pd></plentry><plentry><pt><varname>name</varname></pt><pd>The name of the role to remove.</pd></plentry></parml></section><section id="section5"><title>Examples</title><p>Remove the roles named <codeph>sally</codeph> and <codeph>bob</codeph>:</p><codeblock>DROP ROLE sally, bob;</codeblock></section><section id="section6"><title>Compatibility</title><p>The SQL standard defines <codeph>DROP ROLE</codeph>, but it allows only
one role to be dropped at a time, and it specifies different privilege
requirements than Greenplum Database uses. </p></section><section id="section7"><title>See Also</title><p><codeph><xref href="./REASSIGN_OWNED.xml#topic1" type="topic" format="dita"/></codeph>,
            <codeph><xref href="DROP_OWNED.xml#topic1" type="topic" format="dita"/></codeph>,
            <codeph><xref href="CREATE_ROLE.xml#topic1" type="topic" format="dita"/></codeph>,
            <codeph><xref href="ALTER_ROLE.xml#topic1" type="topic" format="dita"/></codeph>,
            <codeph><xref href="./SET_ROLE.xml#topic1" type="topic" format="dita"/></codeph></p></section></body></topic>
